import base64
import hashlib
import logging
import os
import pathlib
import re
import sys
from http import HTTPStatus
import requests

class Logger:
    def __init__(self,name=__name__):
        # 创建一个logger
        self.__name = name
        self.logger = logging.getLogger(self.__name)
        self.logger.setLevel(logging.DEBUG)

        # 创建一个handler，用于将日志输出到控制台
        ch = logging.StreamHandler()
        ch.setLevel(logging.DEBUG)
        # 定义handler的输出格式
        formatter = logging.Formatter('%(asctime)s-[RUNNER]-%(filename)s--[line:%(lineno)d]'
                                      '-%(levelname)s: %(message)s',
                                      datefmt='%m-%d %H:%M:%S')
        ch.setFormatter(formatter)

        self.logger.addHandler(ch)

    @property       # 调用函数当作属性，无需像方法一样使用
    def get_log(self):
        return self.logger

log = Logger(__name__).get_log




